from myelin.Ns import MYELIN, MYELIN_RULES, DC, DCTERMS
from myelin.rdf.Ns import RDF, RDFS

#from myelin.rdf.bindery.FlatModel import Model
from myelin.rdf.bindery.ScopedModel import Model

from myelin.rdf.bindery.ObjectTypes import LiteralTypeO

from nodetypes.models.ObjectTypes import \
    ResourceTypeO, \
    UserAgentTypeO

from ObjectTypes import \
    RuleTypeO, RuleTypeS

from mappings import \
    BaseMap

class Rule(Model):
    
    ModelTypes = (RuleTypeO, RuleTypeS)
    
    RDF_BINDINGS = {
        'rdfType'           : ((RDF,'type'), ResourceTypeO, BaseMap),
        'rActive'           : ((MYELIN_RULES,'active'), LiteralTypeO, BaseMap),
        'rRule_For'         : ((MYELIN_RULES,'rule-for'), ResourceTypeO, BaseMap),
        'rExecute_User'     : ((MYELIN_RULES,'execute-user'), UserAgentTypeO, BaseMap),
            
        'dctermsCreated'    : ((DCTERMS,'created'), LiteralTypeO, BaseMap),
        'dcCreator'         : ((DC,'creator'), UserAgentTypeO, BaseMap),
        
        'mLast_Modifier'    : ((MYELIN,'last-modifier'), UserAgentTypeO, BaseMap),
        'dctermsModified'   : ((DCTERMS,'modified'), LiteralTypeO, BaseMap),
        
        'rdfsComment'       : ((RDFS,'comment'), LiteralTypeO, BaseMap),
    }    


CLASS_TYPES = {
    MYELIN_RULES + 'Rule' : Rule,
}